<template>
  <a-card :bordered='false' v-show="isShowPage">
    <!-- 查询区域 -->
    <div class='table-page-search-wrapper'  v-show="isShowQuery" >
      <a-form layout='inline'  @keyup.enter.native='searchQuery'>
        <a-row :gutter="24">
          <a-col >
            <a-form-model-item label="年级" prop="gradeId">
              <s-multi-select-tag v-model="queryParam.gradeId" @change='changeGradeId' placeholder="请选择所属年级" dictCode="cou_grade,grade_name,id,tenant_id  is not null order by  grade_order"
                                  :is-pin-yin="false"/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <template v-if="toggleSearchStatus">
          <a-row style='height: 100px'>
            <a-col  >
              <a-form-model-item label="班级" prop="classId" >
                <s-multi-select-tag  v-model="queryParam.classId" placeholder="请选择所属班级" :dictCode="queryParamSelect.classIdSelect" :is-pin-yin="false"/>
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row :gutter='24'>
            <a-col :span='10'>
              <a-form-model-item label='届级' prop='queryParam.classGradesessionYear'>
                <s-dict-select-tag v-model='queryParam.classGradesessionYear' placeholder='请选择届级'
                                   dictCode='cou_gradesession_year,gradesession_year_name,gradesession_year_code,iz_open=1 and del_flag=0 order by  gradesession_year_code' />
              </a-form-model-item>
            </a-col>
            <a-col :span='10'>
              <a-form-model-item label='班级类型' prop='queryParam.classTtype'>
                <s-dict-select-tag v-model='queryParam.classTtype' placeholder='请选择类型'
                                   dictCode='class_ttype' />
              </a-form-model-item>
            </a-col>
            <a-col :md="4" :sm="8">
              <a-form-model-item label="是否启用">
                <s-dict-select-tag type="radioButtonNew" v-model="queryParam.classIzOpen"
                                   dictCode="iz_open" placeholder="选择是否启用状态" />
              </a-form-model-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-model-item label="忽略">
                <j-checkbox
                  v-model="queryParam.ignorePropertyList"
                  :options="queryParamSelect.ignorePropertyList"
                />
<!--                          <a-checkbox-group v-model:value="queryParam.ignorePropertyList"  >-->
<!--                &lt;!&ndash;            显示的对象类型：与字典码保持一致：字典码 course_target_obj_ttype 课表目标对象类型 &ndash;&gt;-->
<!--                &lt;!&ndash;            1-班级(默认)	1，2-教室场地	2，3-老师	3，4-科目	4，5-学生	5   &ndash;&gt;-->
<!--                            <a-checkbox value="1">学年</a-checkbox>-->
<!--                            <a-checkbox value="2">学期</a-checkbox>-->
<!--                          </a-checkbox-group>-->
<!--                <s-dict-select-tag type="radioButtonNew" v-model="queryParam.ignore"-->
<!--                                   dictCode="iz_open" placeholder="选择是否启用状态" />-->
              </a-form-model-item>
            </a-col>
          </a-row>
        </template>
<!--        <a-row :gutter='24'>-->
<!--          <a-col :xl='4' :lg='7' :md='8' :sm='24'>-->
<!--            <a-form-model-item label='班级名称' prop='queryParam.gradeId'>-->
<!--              <a-input v-model='queryParam.className' placeholder='请输入班级名称' />-->
<!--            </a-form-model-item>-->
<!--          </a-col>-->
<!--          <a-col :xl='3' :lg='7' :md='8' :sm='24'>-->
<!--            <a-form-model-item label='班级容量' prop='queryParam.classStudentCapacity'>-->
<!--              <a-input-number v-model='queryParam.classStudentCapacity' placeholder='请输入班级容量' />-->
<!--            </a-form-model-item>-->
<!--          </a-col>-->
<!--        </a-row>-->
        <a-row :gutter='24'>
          <!-- 查询按钮 -->
          <a-col :offset='8'>
            <span style='overflow: hidden;' class='table-page-search-submitButtons'>
              <a-button type='primary' @click='searchQuery' icon='search'>查询</a-button>
              <a-button type='primary' @click='searchReset' icon='reload' style='margin-left: 8px'>重置</a-button>
              <a @click='handleToggleSearch' style='margin-left: 8px'>
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class='table-operator' v-show="isShowOptBtn"  >
      <a-button @click='handleAdd' type='primary' icon='plus'>新增</a-button>
      <a-button type='primary' icon='download' @click="handleExportXls('cou_class')">导出</a-button>
      <a-upload name='file' :showUploadList='false' :multiple='false' :headers='tokenHeader' :action='importExcelUrl'
                @change='handleImportExcel'>
        <a-button type='primary' icon='import'>导入</a-button>
      </a-upload>
      <!-- 高级查询区域 -->
      <!--      <j-super-query :fieldList="superFieldList" ref="superQueryModal"-->
      <!--                     @handleSuperQuery="handleSuperQuery"></j-super-query>-->
      <a-dropdown v-if='selectedRowKeys.length > 0'>
        <a-menu slot='overlay'>
          <a-menu-item key='4' @click='changeGradeVisible = true'>
            <a-icon type='add' />
            批量升级年级
          </a-menu-item>
          <a-menu-item key='3' @click='changeSysOrgCodeVisible = true'>
            <a-icon type='add' />
            批量调整部门
          </a-menu-item>
          <a-menu-item key='2' @click='addUsersVisible = true'>
            <a-icon type='add' />
            创建班级的虚拟登录账号
          </a-menu-item>
          <a-menu-item key='1' @click='batchDel'>
            <a-icon type='delete' />
            删除
          </a-menu-item>
        </a-menu>
        <a-button style='margin-left: 8px'> 批量操作
          <a-icon type='down' />
        </a-button>
      </a-dropdown>
      <template>
        <span style="float:right;">
          <a @click="searchQuery()"><a-icon type="sync" />刷新</a>
          <a-divider type="vertical" />
          <a-button v-print="'#datatable'" ghost type="primary">打印</a-button>
        </span>
      </template>
      <!-- 创建学生登录账号 信息填充弹窗 -->
      <div>
        <a-modal title='创建班级虚拟登录账号' :visible='addUsersVisible' @ok='addUsers()' @cancel='addUsersVisibleCancel'
                 width='40%'>
          <a-row>
            <a-col :span='24'>
              <a-form-model-item label='为班级虚拟账号设置统一登录密码' :labelCol='labelCol' :wrapperCol='wrapperCol'
                                 prop='couclassAddUsers.stupassword'>
                <a-input v-model='couclassAddUsers.stupassword' placeholder='请为班级虚拟用户设置统一登录密码'></a-input>
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-modal>
      </div>


      <!-- 批量调整班级所在部门 信息填充弹窗 -->
      <div>
        <a-modal title='批量调整部门' :visible='changeSysOrgCodeVisible' @ok='changeSysOrgCode()'
                 @cancel='changeSysOrgCodeVisibleCancel' width='40%'>
          <a-row>
            <a-col :span='24'>
<!--              <a-form-model-item label='批量调整所属部门' prop='classchangeSysOrgCode.sysOrgCode'>-->
<!--                <j-select-depart v-model='classchangeSysOrgCode.sysOrgCode' :trigger-change='true'-->
<!--                                 customReturnField='orgCode' :multi='true'></j-select-depart>-->
<!--              </a-form-model-item>-->

              <a-form-model-item label='新部门' prop='classchangeSysOrgCode.sysOrgCode'>
                <j-select-depart v-model='classchangeSysOrgCode.sysOrgCode' :trigger-change='true'
                                 customReturnField='orgCode' :multi='true'></j-select-depart>
              </a-form-model-item>

              <a-form-model-item label='新年级' prop='classchangeSysOrgCode.gradeId'>
                <s-dict-select-tag v-model='classchangeSysOrgCode.gradeId' @change='changeGradeId' placeholder='请选择年级'
                                   dictCode='cou_grade,grade_name,id,tenant_id  is not null order by  grade_order' />
              </a-form-model-item>

              <a-form-model-item label='新届级' prop='classchangeSysOrgCode.classGradesessionYear'>
                <s-dict-select-tag v-model='classchangeSysOrgCode.classGradesessionYear' placeholder='请选择届级'
                                   dictCode='cou_gradesession_year,gradesession_year_name,gradesession_year_code,iz_open=1 and del_flag=0 order by  gradesession_year_code' />
              </a-form-model-item>
              <a-form-model-item label='新学年' prop='classchangeSysOrgCode.schoolYearId'>
                <s-dict-select-tag v-model='classchangeSysOrgCode.schoolYearId' placeholder='请选择学年'
                                   dictCode='cou_school_year,school_year_nickname,id,iz_open=1 order by  school_year_code desc' />
              </a-form-model-item>
              <a-form-model-item label='新学期' prop='classchangeSysOrgCode.semesterId'>
                <s-dict-select-tag v-model='classchangeSysOrgCode.semesterId' placeholder='请选择学期'
                                   dictCode='cou_semester,semester_name,id,tenant_id is not null order by  semester_code' />
              </a-form-model-item>

              <a-form-model-item label='状态' prop='classchangeSysOrgCode.classStatus'>
                <s-dict-select-tag v-model='classchangeSysOrgCode.classStatus' placeholder='请选择状态'
                                   dictCode='class_status' />
              </a-form-model-item>
              <!--              <a-col :span="12">选中的部门Code(v-model):{{ formData.orgCodes }}</a-col>-->
              <!--              <a-form-model-item label="批量调整学生的所属部门" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="classchangeSysOrgCode.sysOrgCode">-->
              <!--                <a-input v-model="classchangeSysOrgCode.sysOrgCode" placeholder="请为学生设置所在部门信息"  ></a-input>-->
              <!--              </a-form-model-item>-->
            </a-col>
          </a-row>
        </a-modal>
      </div>
      <!-- 批量升级年级 信息填充弹窗 -->
      <div>
        <a-modal title='批量升级年级' :visible='changeGradeVisible' @ok='changeGrade()' @cancel='changeGradeVisibleCancel' >

              <a-form-model-item label='批量升级年级' prop='classchangeGrade.gradeId' style="width: 100%">
                <!--                <j-select-depart v-model="classchangeGrade.gradeId" :trigger-change="true" customReturnField="orgCode" :multi="true"></j-select-depart>-->
                <j-dict-select-tag label='新的年级' v-model='classchangeGrade.gradeId' placeholder='请选择年级'
                                   dictCode='cou_grade,grade_name,id,tenant_id  is not null order by  grade_order' style="width: 100%"/>
                <j-dict-select-tag label='新的学年' v-model='classchangeGrade.schoolYearId' placeholder='请选择学年'
                                   dictCode='cou_school_year csy , csy.school_year_name,csy.id ,tenant_id is not null order by csy.school_year_name desc !! csy.create_time  desc' style="width: 100%"/>
                <j-dict-select-tag label='新的学期' v-model='classchangeGrade.semesterId' placeholder='请选择学期'
                                   dictCode='cou_semester cs,cs.semester_name,cs.id,tenant_id is not null order by cs.semester_name desc !! cs.create_time desc' style="width: 100%"/>
              </a-form-model-item>
              <!--              <a-col :span="12">选中的部门Code(v-model):{{ formData.orgCodes }}</a-col>-->
              <!--              <a-form-model-item label="批量调整学生的所属部门" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="classchangeSysOrgCode.sysOrgCode">-->
              <!--                <a-input v-model="classchangeSysOrgCode.sysOrgCode" placeholder="请为学生设置所在部门信息"  ></a-input>-->
              <!--              </a-form-model-item>-->

        </a-modal>
      </div>


    </div>



    <!-- table区域-begin -->
    <div>
      <div class='ant-alert ant-alert-info' style='margin-bottom: 16px;' v-show="isShowOptBtn" >
        <i class='anticon anticon-info-circle ant-alert-icon'></i> 已选择 <a
        style='font-weight: 600'>{{ selectedRowKeys.length }}</a>项
        <a style='margin-left: 24px' @click='onClearSelected'>清空</a>
      </div>

      <a-table
        id="datatable"
        ref='table'
        size='middle'
        :scroll='{x:true}'
        bordered
        rowKey='id'
        :columns='columns'
        :dataSource='dataSource'
        :pagination='ipagination'
        :loading='loading'
        :rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
        class='j-table-force-nowrap'
        @change='handleTableChange'
        :customRow="clickThenCheck">

        <template slot='htmlSlot' slot-scope='text'>
          <div v-html='text'></div>
        </template>
        <template slot='imgSlot' slot-scope='text'>
          <span v-if='!text' style='font-size: 12px;font-style: italic;'>无图片</span>
          <img v-else :src='getImgView(text)' height='25px' alt=''
               style='max-width:80px;font-size: 12px;font-style: italic;' />
        </template>
        <template slot='fileSlot' slot-scope='text'>
          <span v-if='!text' style='font-size: 12px;font-style: italic;'>无文件</span>
          <a-button
            v-else
            :ghost='true'
            type='primary'
            icon='download'
            size='small'
            @click='downloadFile(text)'>
            下载
          </a-button>
        </template>

        <span slot='action' slot-scope='text, record'>
          <a @click='handleEdit(record)'>编辑</a>

          <a-divider type='vertical' />
          <a-dropdown>
            <a class='ant-dropdown-link'>更多 <a-icon type='down' /></a>
            <a-menu slot='overlay'>
              <a-menu-item>
                <a @click='handleDetail(record)'>详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title='确定删除吗?' @confirm='() => handleDelete(record.id)'>
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>

        </span>

      </a-table>
    </div>

    <!-- 折叠部分-->
    <ref-list-cards ref="RefListCards" name="RefListCards" v-show="!thisIsTabPage" :this-is-tab-page="thisIsTabPage" :tabs-cards-list="this.tabsLists" :tabs-query-param-datas="this.tabsQueryParamDatas" ></ref-list-cards>
<!-- 引用弹窗组件 -->
    <cou-class-modal ref='modalForm' name="modalForm" @ok='modalFormOk'></cou-class-modal>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import RefListCards from '@views/smart_school/components/tabscards/RefListCards'
import { filterMultiDictText } from '@/components/dict/JDictSelectUtil'
import { getAction, postAction } from '@api/manage'

export default {
  name: 'CouClassList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    RefListCards,
  },
  props: {
    //变量优先级顺序：props的优先级>data中的优先级>methods中的优先级
    //是否显示全部页面
    isShowPage: {
      type: Boolean,
      default: true
    },
    //本页面是否是被引用的tab页面，tab页面隐藏部分组件
    thisIsTabPage: {
      type: Boolean,
      default: false
    },
    //是否显示查询条件
    isShowQuery: {
      type: Boolean,
      default: true
    },
    isShowOptBtn: {
      type: Boolean,
      default: true
    },
    // 想通过参数控制查询条件
    // searchQueryParamObj: {
    //   type: Object,
    //   default: {}
    // }
  },
  watch: {
    //如果本页是被引用的tab页，隐藏查询条件，隐藏操作按钮
    thisIsTabPage: function (val) {
      if (val) {
        this.isShowQuery = false
        this.isShowOptBtn = false
      }
    }
    // searchQueryParamObj: function(val) {
    //   this.queryParam = val
    // },

  },
  data() {
    return {
      description: 'cou_class管理页面',
      // isShowQuery: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      //查询条件
      queryParam: {
        classIzOpen: "1"
      },
      //下拉查询
      queryParamSelect:{
        classIdSelect: null,
        ignorePropertyList: [
          {label: '学年', value: '1'},
          {label: '学期', value: '2'},
          {label: '部门', value: '3'},
          {label: '届级', value: '4'}
        ],
      },
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '部门',
          align: 'center',
          dataIndex: 'sysOrgCode_dictText'
        },
        {
          title: '班级编码',
          align: 'center',
          dataIndex: 'classCode'
        },
        {
          title: '班级名称',
          align: 'center',
          dataIndex: 'className'
        },
        {
          title: '班级简称',
          align: 'center',
          dataIndex: 'classNickname'
        },
        {
          title: '届级',
          align: 'center',
          dataIndex: 'classGradesessionYear_dictText'
        },
        {
          title: '班级类型',
          align: 'center',
          dataIndex: 'classTtype_dictText'
        },

        {
          title: '班级状态',
          align: 'center',
          dataIndex: 'classStatus_dictText'
        },
        {
          title: '班主任(教师编码)',
          align: 'center',
          dataIndex: 'classHeadmasterCode_dictText'
        },
        {
          title: '班级容量',
          align: 'center',
          dataIndex: 'classStudentCapacity'
        },
        {
          title: '班级人数',
          align: 'center',
          dataIndex: 'classStudentCount'
        },
        {
          title: '是否启用',
          align: 'center',
          dataIndex: 'classIzOpen_dictText'
        },
        {
          title: '班级排序',
          align: 'center',
          dataIndex: 'classOrder'
        },
        {
          title: '学年',
          align: 'center',
          dataIndex: 'schoolYearId_dictText'
        },
        {
          title: '学期',
          align: 'center',
          dataIndex: 'semesterId_dictText'
        },
        {
          title: '班级备注',
          align: 'center',
          dataIndex: 'classRemark'
        },
        {
          title: '年级',
          align: 'center',
          dataIndex: 'gradeCode_dictText'
        },
        {
          title: '虚拟账号',
          align: 'center',
          dataIndex: 'userId_dictText'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/classes/couClass/list',
        delete: '/classes/couClass/delete',
        deleteBatch: '/classes/couClass/deleteBatch',
        exportXlsUrl: '/classes/couClass/exportXls',
        importExcelUrl: 'classes/couClass/importExcel',
        addUsersUrl: '/classes/couClass/addUsers',
        changeSysOrgCodeUrl: '/classes/couClass/changeSysOrgCode',
        changeGradeUrl: '/classes/couClass/changeGrade'

      },
      /* 排序参数 */
      isorter: null,
      // isorter:{
      //   column: 'class_order',
      //   order: 'asc',
      // },
      /* 分页参数 */
      ipagination: {
        current: 1,
        pageSize: 15,
        pageSizeOptions: ['10', '20', '30', '50', '100', '500'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      dictOptions: {},
      superFieldList: [],
      //创建班级登录用户
      couclassAddUsers: {
        stupassword: 'Qinghai123.'
      },
      addUsersVisible: false,
      //调整部门
      classchangeSysOrgCode: {
        ids: null,
        sysOrgCode: null,
        gradeId: null,
        classGradesessionYear: null,
        schoolYearId: null,
        semesterId: null,
        classStatus: '1'

      },
      changeSysOrgCodeVisible: false,
      //升级年级
      classchangeGrade: {
        gradeId: null
      },
      changeGradeVisible: false,
      //页面下方要要显示的tabs列表
      tabsLists: {
        key: 'StuStudentList',
        tabList: [
          {
            key: 'StuStudentList',
            tab: '学生'
          },
          {
            key: 'TeaTeacherList',
            tab: '老师'
          },
          {
            key: 'CouCourseArrangeOneTable',
            tab: '课表'
          }
        ],
      },
      //选中的数据，传给下方引用的tabs
      tabsQueryParamDatas: {
        gradeId: '',
        classId: '',
        studentsId: ''
      }

    }
  },
  created() {
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    initDictConfig() {
    },
    getSuperFieldList() {
      let fieldList = []
      fieldList.push({ type: 'string', value: 'classCode', text: '班级编码', dictCode: '' })
      fieldList.push({ type: 'string', value: 'className', text: '班级名称', dictCode: '' })
      fieldList.push({ type: 'string', value: 'classNickname', text: '班级简称', dictCode: '' })
      fieldList.push({ type: 'int', value: 'classTtype', text: '班级类型', dictCode: 'class_ttype' })
      fieldList.push({ type: 'int', value: 'classStudentCapacity', text: '班级容量', dictCode: '' })
      fieldList.push({ type: 'int', value: 'classStatus', text: '班级状态', dictCode: 'class_status' })
      fieldList.push({ type: 'string', value: 'classHeadmasterCode', text: '班主任(教师编码)', dictCode: '' })
      fieldList.push({ type: 'int', value: 'classStudentCount', text: '班级人数', dictCode: '' })
      fieldList.push({ type: 'int', value: 'classIzOpen', text: '是否启用', dictCode: 'iz_open' })
      fieldList.push({ type: 'int', value: 'classOrder', text: '班级排序', dictCode: '' })
      fieldList.push({ type: 'string', value: 'classRemark', text: '班级备注', dictCode: '' })
      fieldList.push({ type: 'string', value: 'gradeCode', text: '年级code', dictCode: '' })
      this.superFieldList = fieldList
    },
    changeGradeId() {
      if (this.queryParam.gradeId) { //判断不为空
        this.queryParamSelect.classIdSelect = 'cou_class,class_name,id,class_iz_open  =1 and class_iz_delete  = 0 and grade_code in(\'' + this.queryParam.gradeId.replaceAll(',','\'!!\'') + '\') order by  class_order'
      }
    },
    addUsers() {
      if (this.selectionRows.length === 0) {
        alert('请先选择数据')
      } else {

        console.log(this.selectionRows)
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
        }
        // let addUserParm = { ids: ids,stupassword: this.couclassAddUsers.stupassword,  }

        postAction(this.url.addUsersUrl, { ids: ids, stupassword: this.couclassAddUsers.stupassword }).then(res => {
          if (res.code === 200) {
            this.$message.success('虚拟班级账号添加成功')
          } else {
            this.$message.error('虚拟班级账号添加出错，请联系管理员')
          }
        })
      }

      this.addUsersVisible = false
    },
    addUsersVisibleCancel() {
      this.addUsersVisible = false
    },
    //批量调整部门
    changeSysOrgCode() {
      if (this.selectionRows.length === 0) {
        alert('请先选择数据')
      } else {
        //填充新的几项基本信息（试卷编码，试卷名称，所属考试，试卷类型）
        console.log(this.selectionRows)
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
        }
        // let addUserParm = { ids: ids,stupassword: this.studentAddUsers.stupassword,  }
        this.classchangeSysOrgCode.ids = ids;


        postAction(this.url.changeSysOrgCodeUrl,  this.classchangeSysOrgCode).then(res => {
          if (res.code === 200) {
            this.$message.success('调整部门信息成功')
          } else {
            this.$message.error('调整部门信息出错，请联系管理员')
          }
        })
      }

      this.changeSysOrgCodeVisible = false
    },
    changeSysOrgCodeVisibleCancel() {
      this.changeSysOrgCodeVisible = false
    },
    //批量升级年级
    changeGrade() {
      if (this.selectionRows.length === 0) {
        alert('请先选择数据')
      } else {
        //填充新的几项基本信息（试卷编码，试卷名称，所属考试，试卷类型）
        console.log(this.selectionRows)
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
        }
        // let addUserParm = { ids: ids,stupassword: this.studentAddUsers.stupassword,  }
        let params = {
          ids: ids,
          gradeId: this.classchangeGrade.gradeId,
          schoolYearId: this.classchangeGrade.schoolYearId,
          semesterId: this.classchangeGrade.semesterId
        }

        postAction(this.url.changeGradeUrl, params).then(res => {
          if (res.code === 200) {
            this.$message.success('年级升级成功')
          } else {
            this.$message.error('年级升级出错，请联系管理员')
          }
        })
      }

      this.changeGradeVisible = false
    },
    changeGradeVisibleCancel() {
      this.changeGradeVisible = false
    },
    //被引用查询：tab中引用
    getOrderMain(queryParam) {
      console.log("CouClassList.getOrderMain:"+queryParam)
      if (queryParam != null) {
        this.queryParam = queryParam
        //查询页面数据
        this.searchQuery()
      }

    },
    //单击一行记录
    clickThenCheck(record) {
      //如果不是被引用的tab子页，则会查询显示页面下方的tab页数据内容
        return {
          on: {
            click: () => {
              console.log("CouClassList.clickThenCheck():" + record.id.split(',') + [record])
              this.onSelectChange(record.id.split(','), [record])
            }
          }
        }
    },
    //勾选，选中一行记录
    onSelectChange(selectedRowKeys, selectionRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectionRows = selectionRows
      if (this.selectedRowKeys.length >= 1 && !this.thisIsTabPage ) {
        console.log("CouClassList.onSelectChange: selectedRowKeys="+selectedRowKeys+",selectionRows="+selectionRows)
        console.log("CouClassList.onSelectChange: this.selectedRowKeys.length="+this.selectedRowKeys.length+",this.selectionRows.length="+this.selectionRows.length)
        console.log("CouClassList.onSelectChange: ,selectionRows[0]="+JSON.stringify(selectionRows[0]) )
        this.tabsQueryParamDatas = {}
        this.tabsQueryParamDatas.classId = this.selectedRowKeys[0]
        this.tabsQueryParamDatas.gradeId = this.selectionRows[0].gradeCode

        // if (this.tabsLists.key === "CouClassList"){
        //   this.tabsQueryParamDatas = {}
        //   this.tabsQueryParamDatas.classId = this.selectedRowKeys[0]
        //
        // }else if (this.tabsLists.key === "StuStudentList"){
        //   this.tabsQueryParamDatas = {}
        //   //封装查询条件:被引用的tabs中显示的数据
        //   this.tabsQueryParamDatas.classId = this.selectedRowKeys[0]
        // }else if (this.tabsLists.key === "TeaTeacherList"){
        //   this.tabsQueryParamDatas = {}
        //   //封装查询条件:被引用的tabs中显示的数据
        //   this.tabsQueryParamDatas.classId = this.selectedRowKeys[0]
        // }
      }
    },
    //取消选中
    onClearSelected() {
      this.selectedRowKeys = []
      this.selectionRows = []
    },


  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>